#ifndef SCENENODE_H_INCLUDED
#define SCENENODE_H_INCLUDED

#include <vector>
#include <map>
#include <string>
#include <boost/shared_ptr.hpp>
#include <sheeplib/math/mat4.h>
#include <sheeplib/math/vec3.h>

using std::map;
using boost::shared_ptr;
using std::vector;
using std::string;

#include "scene/aabb.h"

namespace engine {

	namespace scene {
		
		class Entity;
		class AABB;
		
		class SceneNode {
			private:
				vector< shared_ptr<SceneNode> > m_Children;
				map<string, shared_ptr<Entity> > m_Objects;
				
				slMat4  m_Transform;
				AABB	m_Bounds;
			public:
				SceneNode();
				virtual ~SceneNode();
				
				const uint getNumAttachedObjects() const;
				bool attachObject(shared_ptr<Entity> newObject);
				void detachObject(const string& name);
				void detachAllObjects();
				
				shared_ptr<Entity> getAttachedObject(const string& name);
				
				void translate(const slVec3& vec);
				void scale(const slVec3& vec);
				void rotate(const slVec3& vec);
			
				const slVec3 getPosition() const;
				void setPosition(const slVec3& vec);
				
				shared_ptr<SceneNode> createChildSceneNode(const string& name, slVec3 vec = slVec3());
				
				const AABB& getBounds() const;
				void updateBounds();
		};
	}
}

#endif // SCENENODE_H_INCLUDED
